﻿<DemoPageSectionComponent Id="Editors-ListBox-VirtualScrolling" ShowSizeMode="true">
    <ChildContentWithParameters Context="Params">
        @inject WorldcitiesDataService WorldcitiesDataService

        @if(Data != null) {
            <DxListBox Data="@Data"
                       ListRenderMode="ListRenderMode.Virtual"
                       TData="Country"
                       TValue="Country"
                       ShowCheckboxes = "true"
                       SelectionMode="ListBoxSelectionMode.Multiple"
                       TextFieldName="@nameof(Country.CountryName)"
                       SizeMode="Params.SizeMode"
                       CssClass="cw-400 chi-220">
            </DxListBox>
        }
    </ChildContentWithParameters>

    @code {
        IEnumerable<Country> Data { get; set; }

        protected override async Task OnInitializedAsync() {
            Data = await WorldcitiesDataService.GetCountriesAsync();
        }
    }
</DemoPageSectionComponent>
